YES 0.882 H-Termination proof of /home/matraf/haskell/eval_FullyBlown_Fast/FiniteMap.hs
H-Termination of the given Haskell-Program with start terms could successfully be proven:



HASKELL
  ↳ CR

mainModule FiniteMap
  ((lookupWithDefaultFM :: FiniteMap Bool a  ->  a  ->  Bool  ->  a) :: FiniteMap Bool a  ->  a  ->  Bool  ->  a)

module FiniteMap where
  import qualified Maybe
import qualified Prelude

  data FiniteMap a b = EmptyFM  | Branch a b Int (FiniteMap a b) (FiniteMap a b


  instance (Eq a, Eq b) => Eq (FiniteMap b a) where 

  lookupFM :: Ord b => FiniteMap b a  ->  b  ->  Maybe a
lookupFM EmptyFM key Nothing
lookupFM (Branch key elt _ fm_l fm_rkey_to_find 
 | key_to_find < key = 
lookupFM fm_l key_to_find
 | key_to_find > key = 
lookupFM fm_r key_to_find
 | otherwise = 
Just elt

  lookupWithDefaultFM :: Ord b => FiniteMap b a  ->  a  ->  b  ->  a
lookupWithDefaultFM fm deflt key 
case lookupFM fm key of
  Nothing-> deflt
  Just elt-> elt


module Maybe where
  import qualified FiniteMap
import qualified Prelude



Case Reductions:
The following Case expression
case lookupFM fm key of
 Nothing → deflt
 Just elt → elt

is transformed to
lookupWithDefaultFM0 deflt Nothing = deflt
lookupWithDefaultFM0 deflt (Just elt) = elt



↳ HASKELL
  ↳ CR
HASKELL
      ↳ BR

mainModule FiniteMap
  ((lookupWithDefaultFM :: FiniteMap Bool a  ->  a  ->  Bool  ->  a) :: FiniteMap Bool a  ->  a  ->  Bool  ->  a)

module FiniteMap where
  import qualified Maybe
import qualified Prelude

  data FiniteMap a b = EmptyFM  | Branch a b Int (FiniteMap a b) (FiniteMap a b


  instance (Eq a, Eq b) => Eq (FiniteMap b a) where 

  lookupFM :: Ord a => FiniteMap a b  ->  a  ->  Maybe b
lookupFM EmptyFM key Nothing
lookupFM (Branch key elt _ fm_l fm_rkey_to_find 
 | key_to_find < key = 
lookupFM fm_l key_to_find
 | key_to_find > key = 
lookupFM fm_r key_to_find
 | otherwise = 
Just elt

  lookupWithDefaultFM :: Ord a => FiniteMap a b  ->  b  ->  a  ->  b
lookupWithDefaultFM fm deflt key lookupWithDefaultFM0 deflt (lookupFM fm key)

  
lookupWithDefaultFM0 deflt Nothing deflt
lookupWithDefaultFM0 deflt (Just eltelt


module Maybe where
  import qualified FiniteMap
import qualified Prelude



Replaced joker patterns by fresh variables and removed binding patterns.

↳ HASKELL
  ↳ CR
    ↳ HASKELL
      ↳ BR
HASKELL
          ↳ COR

mainModule FiniteMap
  ((lookupWithDefaultFM :: FiniteMap Bool a  ->  a  ->  Bool  ->  a) :: FiniteMap Bool a  ->  a  ->  Bool  ->  a)

module FiniteMap where
  import qualified Maybe
import qualified Prelude

  data FiniteMap a b = EmptyFM  | Branch a b Int (FiniteMap a b) (FiniteMap a b


  instance (Eq a, Eq b) => Eq (FiniteMap a b) where 

  lookupFM :: Ord b => FiniteMap b a  ->  b  ->  Maybe a
lookupFM EmptyFM key Nothing
lookupFM (Branch key elt vw fm_l fm_rkey_to_find 
 | key_to_find < key = 
lookupFM fm_l key_to_find
 | key_to_find > key = 
lookupFM fm_r key_to_find
 | otherwise = 
Just elt

  lookupWithDefaultFM :: Ord b => FiniteMap b a  ->  a  ->  b  ->  a
lookupWithDefaultFM fm deflt key lookupWithDefaultFM0 deflt (lookupFM fm key)

  
lookupWithDefaultFM0 deflt Nothing deflt
lookupWithDefaultFM0 deflt (Just eltelt


module Maybe where
  import qualified FiniteMap
import qualified Prelude



Cond Reductions:
The following Function with conditions
lookupFM EmptyFM key = Nothing
lookupFM (Branch key elt vw fm_l fm_rkey_to_find
 | key_to_find < key
 = lookupFM fm_l key_to_find
 | key_to_find > key
 = lookupFM fm_r key_to_find
 | otherwise
 = Just elt

is transformed to
lookupFM EmptyFM key = lookupFM4 EmptyFM key
lookupFM (Branch key elt vw fm_l fm_rkey_to_find = lookupFM3 (Branch key elt vw fm_l fm_rkey_to_find

lookupFM1 key elt vw fm_l fm_r key_to_find True = lookupFM fm_r key_to_find
lookupFM1 key elt vw fm_l fm_r key_to_find False = lookupFM0 key elt vw fm_l fm_r key_to_find otherwise

lookupFM2 key elt vw fm_l fm_r key_to_find True = lookupFM fm_l key_to_find
lookupFM2 key elt vw fm_l fm_r key_to_find False = lookupFM1 key elt vw fm_l fm_r key_to_find (key_to_find > key)

lookupFM0 key elt vw fm_l fm_r key_to_find True = Just elt

lookupFM3 (Branch key elt vw fm_l fm_rkey_to_find = lookupFM2 key elt vw fm_l fm_r key_to_find (key_to_find < key)

lookupFM4 EmptyFM key = Nothing
lookupFM4 wv ww = lookupFM3 wv ww

The following Function with conditions
compare x y
 | x == y
 = EQ
 | x <= y
 = LT
 | otherwise
 = GT

is transformed to
compare x y = compare3 x y

compare1 x y True = LT
compare1 x y False = compare0 x y otherwise

compare2 x y True = EQ
compare2 x y False = compare1 x y (x <= y)

compare0 x y True = GT

compare3 x y = compare2 x y (x == y)

The following Function with conditions
undefined 
 | False
 = undefined

is transformed to
undefined  = undefined1

undefined0 True = undefined

undefined1  = undefined0 False



↳ HASKELL
  ↳ CR
    ↳ HASKELL
      ↳ BR
        ↳ HASKELL
          ↳ COR
HASKELL
              ↳ Narrow

mainModule FiniteMap
  (lookupWithDefaultFM :: FiniteMap Bool a  ->  a  ->  Bool  ->  a)

module FiniteMap where
  import qualified Maybe
import qualified Prelude

  data FiniteMap b a = EmptyFM  | Branch b a Int (FiniteMap b a) (FiniteMap b a


  instance (Eq a, Eq b) => Eq (FiniteMap b a) where 

  lookupFM :: Ord b => FiniteMap b a  ->  b  ->  Maybe a
lookupFM EmptyFM key lookupFM4 EmptyFM key
lookupFM (Branch key elt vw fm_l fm_rkey_to_find lookupFM3 (Branch key elt vw fm_l fm_r) key_to_find

  
lookupFM0 key elt vw fm_l fm_r key_to_find True Just elt

  
lookupFM1 key elt vw fm_l fm_r key_to_find True lookupFM fm_r key_to_find
lookupFM1 key elt vw fm_l fm_r key_to_find False lookupFM0 key elt vw fm_l fm_r key_to_find otherwise

  
lookupFM2 key elt vw fm_l fm_r key_to_find True lookupFM fm_l key_to_find
lookupFM2 key elt vw fm_l fm_r key_to_find False lookupFM1 key elt vw fm_l fm_r key_to_find (key_to_find > key)

  
lookupFM3 (Branch key elt vw fm_l fm_rkey_to_find lookupFM2 key elt vw fm_l fm_r key_to_find (key_to_find < key)

  
lookupFM4 EmptyFM key Nothing
lookupFM4 wv ww lookupFM3 wv ww

  lookupWithDefaultFM :: Ord a => FiniteMap a b  ->  b  ->  a  ->  b
lookupWithDefaultFM fm deflt key lookupWithDefaultFM0 deflt (lookupFM fm key)

  
lookupWithDefaultFM0 deflt Nothing deflt
lookupWithDefaultFM0 deflt (Just eltelt


module Maybe where
  import qualified FiniteMap
import qualified Prelude



Haskell To QDPs


↳ HASKELL
  ↳ CR
    ↳ HASKELL
      ↳ BR
        ↳ HASKELL
          ↳ COR
            ↳ HASKELL
              ↳ Narrow
QDP
                  ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

new_lookupWithDefaultFM0(wx4, Branch(False, wx31, wx32, wx33, wx34), True, h) → new_lookupWithDefaultFM0(wx4, wx34, True, h)
new_lookupWithDefaultFM0(wx4, Branch(True, wx31, wx32, wx33, wx34), False, h) → new_lookupWithDefaultFM0(wx4, wx33, False, h)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 2 SCCs.

↳ HASKELL
  ↳ CR
    ↳ HASKELL
      ↳ BR
        ↳ HASKELL
          ↳ COR
            ↳ HASKELL
              ↳ Narrow
                ↳ QDP
                  ↳ DependencyGraphProof
                    ↳ AND
QDP
                        ↳ QDPSizeChangeProof
                      ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

new_lookupWithDefaultFM0(wx4, Branch(True, wx31, wx32, wx33, wx34), False, h) → new_lookupWithDefaultFM0(wx4, wx33, False, h)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ HASKELL
  ↳ CR
    ↳ HASKELL
      ↳ BR
        ↳ HASKELL
          ↳ COR
            ↳ HASKELL
              ↳ Narrow
                ↳ QDP
                  ↳ DependencyGraphProof
                    ↳ AND
                      ↳ QDP
QDP
                        ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

new_lookupWithDefaultFM0(wx4, Branch(False, wx31, wx32, wx33, wx34), True, h) → new_lookupWithDefaultFM0(wx4, wx34, True, h)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: